package com.ww.springboot.boot.jvm;

/**
 * 描述：
 *
 * @author wanwei
 * @since 2021-05-15 15:17
 */
public class 动态对象年龄判断 {

    private static final int _1MB = 1024 * 1024;

    /**
     * VM参数：-verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:+PrintGCDetails -XX:SurvivorRatio=8
     * -XX:MaxTenuringThreshold=15
     * -XX:+PrintTenuringDistribution
     */
    @SuppressWarnings("unused")
    public static void main(String[] args) {
        byte[] allocation1, allocation2, allocation3, allocation4;
        byte[] allocation11, allocation22, allocation33, allocation44;

        allocation1 = new byte[_1MB / 4];  // allocation1+allocation2大于survivo空间一半
        allocation2 = new byte[_1MB / 4];
        allocation3 = new byte[_1MB / 4];
        allocation4 = new byte[_1MB / 4];
        allocation11 = new byte[_1MB / 4];
        allocation22 = new byte[_1MB * 4];
        allocation33 = new byte[_1MB * 4];
        allocation44 = new byte[_1MB * 14];
    }
}
